package vn.outsource.weather.ui;

import com.example.com.outsource.weather.R;

import vn.tdx.androidlibs.connection.RequestType;
import vn.tdx.androidlibs.connection.Response;
import vn.tdx.androidlibs.connection.ResponseData;
import vn.tdx.androidlibs.connection.ResponseReceiver;
import vn.tdx.androidlibs.connection.request.SplashRequest;
import vn.tdx.androidlibs.ui.BaseFragmentActivity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.content.Loader;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class SplashActivity extends BaseFragmentActivity implements ResponseReceiver{
	private static final String TAG="SplashActivity";
	
	private WebView mWebView;
	@Override
	protected void onCreate(Bundle arg0) {
		super.onCreate(arg0);
		requestServer(1, RequestType.SPLASH, new SplashRequest());
	}
	
	@Override
	protected void setContentView(Bundle bundle) {
		setContentView(R.layout.activity_splash);
		initView();
	}
	private void initView(){
		mWebView=(WebView)findViewById(R.id.activity_splash_webview);
		
		mWebView.setWebViewClient(new WebViewClient());
		mWebView.loadUrl("file:///android_asset/splash.html");
	}
	@Override
	protected boolean isNavigationEnable() {
		return false;
	}

	@Override
	public void receiveResponse(Loader<Response> loader, Response response) {
		startActivity(new Intent(this,MainActivity.class));
		finish();
	}

	@Override
	public Response parseResponse(int loaderID, ResponseData data,
			int requestType) {
		try {
			Thread.sleep(0000);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public void onLoaderReset(Loader<Response> loader) {
		// TODO Auto-generated method stub
		
	}
}
